package com.software.comment.pojo;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 周昊
 * @since 2024/12/16 11：34
 * @version 1.0
 */
@Data
public class Comment implements Serializable {
    /**
     * 评论id
     */
    private Integer id;

    /**
     * 评论的用户名
     */
    private String username;

    /**
     * 评论所在的任务id
     */
    private Integer taskId;

    /**
     * 评论创建时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    /**
     * 被回复的评论的用户名
     */
    private String replyUsername;

    /**
     * 评论内容
     */
    @NotEmpty(message = "评论内容不能为空")
    private String content;

    /**
     * 评论层级，顶层评论为0，二级评论为1，以此类推
     */
    private Integer level;

    /**
     * 顶层评论id
     */
    private Integer parentCommentId;

    /**
     * 被回复的评论id
     */
    private Integer replyParentCommentId;

    /**
     * 评论附带的图片地址
     */
    private String commentPic;

}